class Solution {
public:
    bool isStraight(vector<int>& nums) {
        int count=0;
        int sum=0;
        sort(nums.begin(),nums.end());
        for(int i=0;i<nums.size()-1;i++){
            //记录大小王存在的次数
            if(nums[i]==0){
                count++;
            }else{
                //有相同非0数则返回false
                if(nums[i]==nums[i+1]) return false;
                //不为递增则得出其差值
                if(nums[i+1]!=nums[i]+1){
                    sum+=nums[i+1]-nums[i]-1;
                }
            }
        }
        return count>=sum;
    }
};